In general, a method of detecting tonal information of a musical composition is known. The tonal information indicates elements which determine an image of the musical composition (a key, for example). As an exemplary method of detecting a key of a musical composition, there is a method (a first method) in which, based on information concerning a scale of a musical composition (hereinafter, referred to as scale information), appearance probabilities of pitch names included in the scale information are calculated for each of the pitch names, and a key of the musical composition is detected by using a distribution showing the appearance probabilities of the respective pitch names (referred to as an appearance probability distribution. See FIG. 3 to be described later). In this method, ideal appearance probability distributions of a plurality of types of keys are previously created and prepared respectively as templates. Then, an appearance probability distribution of a musical composition in which a key is to be detected is calculated, and the appearance probability distribution of the musical composition is compared with those represented by the templates one by one. As a result, a key, represented by one of the templates showing an appearance probability distribution most analogous to that of the musical composition, is determined as the key of the musical composition.
Also, in general, there is another method in which the scale information to be inputted is divided into predetermined segments, and a key of each of the segments is detected (see patent document 1, for example). In this method, the scale information of a musical composition is divided into a plurality of segments in such a manner as to determine first to fourth bars of the musical composition as a first segment, and second to fifth bars of the musical composition as a subsequent segment, for example. Thereafter, the key of each of the plurality of segments is detected. [patent document 1] Japanese Patent Publication No. 2715816
In reality, there maybe a musical composition composed in a plurality of types of keys such as a musical composition including a modulation. An appearance probability distribution of such a musical composition including the modulation is obtained by combining appearance probability distributions of the plurality of types of keys with each other. Therefore, the obtained appearance probability distribution may be different from any of the appearance probability distributions of the plurality of types of keys. In the first method, the appearance probability distribution of the musical composition is compared with those represented by the templates one by one. Thus, even when the appearance probability of the musical composition is obtained by combining the appearance probability distributions of the plurality of types of keys with each other, a key, represented by one of the templates showing an appearance probability distribution most analogous to the combined appearance probability distribution of the musical composition, is determined as the key of the musical composition. That is, in this case, the key determined as the key of the musical composition is different from any of keys included in the musical composition. Therefore, when the first method is used, the keys of a musical composition, composed in a plurality of types of keys such as a musical composition including a modulation, may be mistakenly detected.
Furthermore, in the method disclosed in patent document 1, the scale information of the musical composition is divided into the plurality of segments, and a key of each of the segments is detected. Then, a point at which the musical composition modulates is detected by a change in a key between each two of the segments. Note that a target portion in which a key is to be detected is not the entirety of the inputted scale information, but is each of the segments, having a short length, into which the scale information is divided. Specifically, when the method of patent document 1 is used to detect the modulation, the scale information must be divided into the segments each having a length corresponding to at least several bars (four bars, for example). However, when the scale information is divided into the plurality of segments, the number of notes included in a target portion, in which a key is to be detected, is decreased. That is, by dividing the scale information into the plurality of segments, the number of pieces of information included in the target portion, in which the key is to be detected, is decreased. Thus, an accuracy for detecting the key is necessarily reduced. As described above, in the method of patent document 1, the scale information must be divided into the plurality of segments, thereby reducing the accuracy for detecting the key of each of the segments.
Therefore, an objective of the present invention is to provide a musical composition processing device capable of accurately detecting tonal information of a musical composition, even if the musical composition includes a modulation.